﻿@model IEnumerable<Qcy.Jshj.Web.Models.Article>
@{
    ViewBag.Title = "在线订单";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<script src="~/Scripts/easyui/plugins/datagrid-detailview.js"></script>
<table id="datalist" class="easyui-datagrid" style="top: 35px; width: auto; height: 630px;"
    data-options="rownumbers:true,singleSelect:true,toolbar:'#tb',url:'/Admin/GetOrders',pagination:true,pageSize:20">
    <thead>
        <tr>
            <th data-options="field:'LinkMan',width:100">联系人</th>
            <th data-options="field:'LinkMan',width:100">公司名称</th>
            <th data-options="field:'Phone',width:90">联系电话</th>
            <th data-options="field:'Email',width:100">Email</th>
            <th data-options="field:'CreationDateString',width:100">更新时间</th>
        </tr>
    </thead>
</table>
<div id="tb" style="padding: 5px; height: auto">
    <div>
        关键词:
        <input class="easyui-textbox" name="keyword" id="keyword" />
        发布时间 从:
            <input id="datestart" class="easyui-datebox" type="text" style="width: 90px;" readonly="readonly">
        到:
            <input id="dateend" class="easyui-datebox" type="text" style="width: 90px" readonly="readonly">
        <a href="javascript:void(0);" onclick="model.search();" class="easyui-linkbutton" iconcls="icon-search">搜索</a>
        <a href="javascript:void(0);" onclick="model.reset();" class="easyui-linkbutton">重置</a>
    </div>
</div>
<script>
    $(function () {
        model.load();
    });
    var model = {
        load: function () {
            $('#datalist').datagrid({
                queryParams: {
                    keyword: $('#keyword').val(),
                    datestart: $('#datestart').datebox('getValue'),
                    dateend: $('#dateend').datebox('getValue')
                },
                view: detailview,
                detailFormatter: function (index, row) {
                    return '<div id="ddv-' + index + '" style="padding:5px 0"></div>';
                },
                onExpandRow: function (index, row) {
                    $('#ddv-' + index).panel({
                        border: false,
                        cache: false,
                        href: '/Admin/OrderContent/' + row.Id,
                        onLoad: function () {
                            $('#datalist').datagrid('fixDetailRowHeight', index);
                        }
                    });
                    $('#datalist').datagrid('fixDetailRowHeight', index);
                }
            });
        },
        search: function () { this.load() },
        selected: function () {
            return $('#datalist').datagrid('getSelected');
        },
        reset: function () {
            $('#keyword').val("");
            $('#datestart').datebox('setValue', '');
            $('#dateend').datebox('setValue', '');
            this.load();
        }
    };
</script>
